home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
426-450
/
disk_429
/
uedit-stuff
/
delete
< prev
next >
Wrap
Text File
|
1992-05-06
|
15KB
|
363 lines
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*** Uedit scratch-delete functions which remember the last eight deletes
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
n28 contains the number of the buffer that holds the newest cut. This gets
bumped by virtual-kp7 just before the cut is made, if it isn't merging with
the last one. To change the range of buffers that is used to store cut
pieces (currently 80 to 87), you only need to change three commands: the
ring rotating commands lAmiga-kp4 and lAmiga-kp6, and the general deleting
engine virtual-kp7, at the lines where the comment says "Bounds". If you
want to change the n-vars used, you'll have to change lots of commands.
n27 is the buffer the last cut was made in, or -1 if any paste has been made
since the last cut. It is -2 after ctl-kp0 if it was nonnegative before,
which means don't merge the next cut, but don't allow operations that work on
the last paste either (lamiga-kp1, lamiga-kp0).
General scratch deleter - decide whether to merge, then move locA-locB to ring
<virtual-kp7: if (eqnum(n27, curfile)) .. shall we merge? last cut was here
if (not eqloc(curfile, locA, mouseloc)) .. mouseloc is
if (not eqloc(curfile, locB, mouseloc)) .. old locB
equatenum(n27, -2) .. no
equatenum(n54, n28) .. ** for virtual-kp4 split display
if (not eqnum(n27, curfile)) { .. un-merge:
if (genum(80, n28)) equatenum(n28, 87) .. Bounds
else decnum(n28)
freeBuf(buf[n28])
} else if (gtnum(80, n28)) equatenum(n28, 87) .. Bounds
if (eqloc(curfile, mouseloc, locA)) .. front or back?
insertrgn(buf[n28], efile, curfile, loc)
else insertrgn(buf[n28], sfile, curfile, loc)
equateloc(buf[n28], spage, sfile) .. cosmetic
clearrgn(curfile, loc) .. mustn't forget to actually delete!
if (genum(n54, 80)) .. ** Bounds
runkey(virtual-kp4) .. ** update split window
equatenum(n27, curfile)
>
Those lines marked with ** can be removed for speed if desired. They
cause a split window made with lamiga-1 to be updated in real time as you
delete things.
Show top of delete ring in split window
<lamiga-1: equatenum(n54, curfile)
if (not eqnum(curfile, n28)) if (not gotosplit(buf[n28])) {
splitwindow(buf[n28], splitsize)
gotosplit(buf[n54]) .. not curfile unless press it again
}
putmsg("Use lAmiga-kp4 and lAmiga-kp6 to rotate ring")
>
*** HERE'S THE SIMPLE VERSION that leaves the split window curfile ***
Show top of delete ring in split window
.. <lamiga-1: if (not eqnum(curfile, n28)) if (not gotosplit(buf[n28]))
splitwindow(buf[n28], splitsize)
putmsg("Use lAmiga-kp4 and lAmiga-kp6 to rotate ring")
>
Push back newest entry on scratch delete ring
<lamiga-kp4: equatenum(n54, n28)
if (genum(n28, 87)) equatenum(n28, 80) .. Bounds
else incnum(n28)
runkey(virtual-kp4)
>
Pull forward oldest entry on scratch delete ring
<lamiga-kp6: equatenum(n54, n28)
if (genum(80, n28)) equatenum(n28, 87) .. Bounds
else decnum(n28)
runkey(virtual-kp4)
>
Display correct buffer in top-of-delete-ring split window
<virtual-kp4: if (eqnum(curfile, n54)) editbuf(buf[n28])
else {
equatenum(n53, curfile)
if (gotosplit(buf[n54])) {
editbuf(buf[n28])
gotosplit(buf[n53])
}
}
>
Undo last paste (kp0), hopefully only when it was just done
<lamiga-kp0: if (not eqnum(n27, -1)) {
putmsg("No paste since last cut")
returnfalse
}
if (not eqloc(curfile, atcursor, locB)) {
putmsg("Can't un-paste -- wrong location")
returnfalse
}
clearrgn(curfile, loc)
equatenum(n27, curfile)
>
Go to location of last scratch delete or undo
<lamiga-kp5: movecursor(curfile, locB) >
Go to top end of last scratch undo, or maybe anywhere
<lamiga-kp8: if (not eqnum(n27, -1)) putmsg("No paste since last cut")
else movecursor(curfile, locA)
>
Undo latest scratch delete, inserting at cursor, marking with loc
<normal-kp0: if (eqnum(n28, 0)) return .. no cut since start!
equateloc(curfile, locA, atcursor)
if (eqloc(curfile, atcursor, sfile)) {
insertrgn(curfile, sfile, buf[n28], all)
equateloc(curfile, locA, sfile)
} else {
equateloc(curfile, locA, atcursor)
decloc(curfile, locA)
insertRgn(curFile,atCursor,buf[n28],all)
incloc(curfile, locA)
}
equateloc(curfile, locB, atcursor)
equatenum(n27, -1)
if (thiskey)
if (eqloc(curfile, atcursor, spage)) { .. don't you hate it
vscroll(atcursor) .. when the pasted-in
updatedisplay .. text is offscreen?
}
>
Set search string, using text of last cut
<shftaltctl-f7: freebuf(buf49)
insertrgn(buf49, sfile, buf[n28], all)
putmsg("Input search string:")
inputstring(buf49)
setsearch(buf49)
runkey(normal-f9)
>
Replace last paste with older cut, hopefully only when it was just done
<lamiga-kp1: if (runkey(lamiga-kp0)) {
runkey(lamiga-kp4)
runkey(normal-kp0)
}
>
Prevent next delete from merging with the previous one
<ctl-kp0: if (genum(n27, 0)) equatenum(n27, -2) >
Delete word left, storing it in Undo buffer
<normal-kp7: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
movecursor(curfile, sword)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
>
Delete word right, storing it in Undo buffer
<normal-kp9: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
movecursor(curfile, eword)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
>
Delete char to left of cursor, storing it in Undo buffer
<shft-kp7: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
movecursor(curfile, schar)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
>
Delete char under cursor, storing it in Undo buffer
<shft-kp9: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
movecursor(curfile, echar)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
>
Delete to start of line, storing it in Undo buffer
<alt-kp7: if (is(curFile,sLine)) runKey(shft-kp7)
else {
equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
movecursor(curfile, sline)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
}
>
Delete to end of line, storing it in Undo buffer
<alt-kp9: if (is(curFile,eLine)) runKey(shft-kp9)
else {
equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
movecursor(curfile, eline)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
}
>
Personally, I don't use these next two, they're too accident-prone.
Delete from cursor to start of window, storing it in Undo buffer
<ctl-kp7: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
movecursor(curfile, spage)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
vscroll(atcursor)
updatedisplay
>
Delete from cursor to end of window, storing it in Undo buffer
<ctl-kp9: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
movecursor(curfile, epage)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
vscroll(atcursor)
updatedisplay
>
Delete cursor line
<virtual-x: equateLoc(curFile, mouseLoc, locB)
if (not is(curFile,sLine)) moveCursor(curFile,sLine)
equateloc(curfile, locA, atcursor)
if (not is(curFile,eLine)) moveCursor(curFile,eLine)
moveCursor(curFile,eChar)
equateLoc(curFile,locB,atCursor)
runkey(virtual-kp7)
>
(redundant with standard config)
UNDO newest scratch delete, inserting at cursor
<alt-kp0: runKey(normal-kp0) >
UNDO newest scratch delete, inserting at cursor
<shft-kp0: runKey(normal-kp0) >
Delete cursor line, storing it in Undo buffer. (See keypad-0/7/9.)
<ctl-d: runKey(virtual-x) >
Delete line above cursor line
<ctl-del: locToCol(curfile, n50, atCursor)
if (moveCursor(curFile,upLine)) {
runKey(virtual-x) .. this deletes the line
colToLoc(curfile, atCursor, n50)
}
>
Delete line below cursor line
<ctl-bs: locToCol(curfile, n50, atcursor)
if (moveCursor(curFile,downLine)) {
runKey(virtual-x) .. this deletes the line
moveCursor(curFile,upLine)
colToLoc(curfile, atCursor, n50)
}
>
Delete from cursor back to most recent occurence of character
<lamiga-kp7: putmsg("What character should mark the start of the delete?")
getchar(n0)
equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
decloc(curfile, atcursor) .. skip first character
equatenum(n1, -1)
if (runkey(virtual-/)) {
movecursor(curfile, echar)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
putmsg(" ")
} else {
movecursor(curfile, locB)
equateloc(curfile, locB, mouseloc)
putmsg("Not found.")
}
setsearch(buf53)
>
Delete from cursor to next occurence of a given character
<lamiga-kp9: putmsg("What character should mark the end of the delete?")
getchar(n0)
equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
equatenum(n1, 1)
if (runkey(virtual-/)) {
equateloc(curfile, locA, locB) .. swap ends
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
putmsg(" ")
} else {
equateloc(curfile, locB, mouseloc)
putmsg("Not found.")
}
setsearch(buf53)
>
Search for single char n0 in direction n1, trashing locA, using your searchCaps
<virtual-/: freebuf(buf54)
insertchar(buf54, "\\")
insertchar(buf54, n0)
freebuf(buf53)
getsearch(buf53)
setsearch(buf54)
search(curfile, locA, locA, n1) .. don't care which
> returns true or false depending on search end locA ends up on
Extend the last scratch delete to cursor in either direction
<lamiga-kp3: if (gtloc(curfile, atcursor, locB)) {
equateloc(curfile, locA, locB)
equateloc(curfile, locB, atcursor)
equateloc(curfile, mouseloc, locA)
} else {
equateloc(curfile, locA, atcursor)
equateloc(curfile, mouseloc, locB)
}
runkey(virtual-kp7)
>
Delete back to end of indent whitespace
<shftalt-kp7: loctocol(curfile, n51, atcursor)
if (not runkey(ctl-[)) returnfalse .. ctl-[ is missing!
if (gtnum(n51, n50)) {
equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
coltoloc(curfile, atcursor, n51)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
} else coltoloc(curfile, atcursor, n51)
>
Delete from cursor to start of paragraph (last blank line)
<shftctl-kp7: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locB, atcursor)
while (decloc(curfile, atcursor))
if (is(curfile, whitespace)) goto label (47)
label (47)
while (movecursor(curfile, upline))
if (is(curfile, blankline)) {
movecursor(curfile, downline)
if (not is(curfile, sline)) movecursor(curfile, sline)
goto label (1)
}
movecursor(curfile, sfile)
label (1)
equateloc(curfile, locA, atcursor)
runkey(virtual-kp7)
>
Delete from cursor to end of paragraph (next blank line)
<shftctl-kp9: equateloc(curfile, mouseloc, locB)
equateloc(curfile, locA, atcursor)
while (incloc(curfile, atcursor))
if (is(curfile, whitespace)) goto label (47)
label (47)
while (movecursor(curfile, downline))
if (is(curfile, blankline)) {
if (not is(curfile, sline)) movecursor(curfile, sline)
movecursor(curfile, schar)
goto label (1)
}
movecursor(curfile, efile)
label (1)
equateloc(curfile, locB, atcursor)
runkey(virtual-kp7)
>